package com.heima.feign.client;

import com.heima.model.schedule.dtos.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("leadnews-schedule")
public interface ScheduleFeginClient {

    /**
     * 添加任务
     * @param task
     * @return
     */
    @PostMapping("/api/v1/task/add")
    public long addTask(@RequestBody Task task);


    /**
     * 拉取任务
     * @param type
     * @param priority
     * @return
     */
    @GetMapping("/api/v1/task/poll/{type}/{priority}")
    public Task poll(@PathVariable int type, @PathVariable int priority);
}
